<%@ page import="com.itheima.domain.Student" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>查看所有学生信息页面</title>
    <style>
        a{
            text-decoration: none;
            color: red;
        }
        a:hover{
            color: darkmagenta;
        }
        #search{
            text-align: center;
           color: darkred;
        }


    </style>
</head>
<body>
<%--判断用户是否登录 没有登录就重定向到登录页面--%>
<font size="5" color="#8b008b">欢迎您,${username}</font>

<div id="search">
    <form action="${pageContext.request.contextPath}/stu/findByCondition" method="get" autocomplete="on">
        年龄:<input type="text" name="age" placeholder="请输入年龄">
        分数:<input type="text" name="score" value="" placeholder="请输入分数">
        <button type="submit"><font color="red" >查询</font></button>
    </form>
</div>



<table width="400px" border="1px" align="center" cellspacing="0">
    <p><br><caption>学生信息列表</caption>
    <tr bgcolor="gray">
        <th>学号</th>
        <th>姓名</th>
        <th>年龄</th>
        <th>分数</th>
        <th colspan="2">操作</th>
    </tr></p>

<%--
    <%
        ArrayList<Student> List = (ArrayList<Student>) session.getAttribute("stuList");
        //遍历集合 得到学习信息
        for (Student stu : List) {

    %>--%>
    <c:forEach var="stu" items="${stuList}">
        <%--${stu}--%>

    <tr align="center"></tr>
        <td align="center">${stu.sid}</td>
        <td align="center">${stu.username}</td>
        <td align="center">${stu.age}</td>
        <td align="center">${stu.score}</td>
        <td><center><a href="${pageContext.request.contextPath}/stu/delete?sid=${stu.sid}">删除</a></center></td>
        <td><center><a href="${pageContext.request.contextPath}/updateStudent.jsp?sid=${stu.sid}&username=${stu.username}&age=${stu.age}&score=${stu.score}">修改</a></center></td>
    </c:forEach>



</table>
<br>
 <p ><font size="3" color="#663399"><center><a href="${pageContext.request.contextPath}/addStudent.jsp">添加学生</a></center></font></p>
</body>
</html>
